/* SimpleLogin
 *
 *
 *  NOTE: "target" must always be "body".
 */ 
  define(["ControllerBase"], function(ControllerBase) {
	function SimpleLogin(name, target, props) {
		this.__proto__ = new ControllerBase(name, target, props);
		this.__proto__.type = 'SimpleLogin';

		// Private members.
		var _block;
		var _maxRetries;
		var _retries;
		
		
		// Add any extended events to the allowed list.
		this.__events__ = 'success';
		this.__events__ = 'error';
		this.__events__ = 'forgotPassword';

		// Ensure we are marked as not "headless"
		_headless = false;
				
		// Parse for our custom properties, if any.
		if (props) {
			_block = (props['block']) ? props['block'] : true;
			_maxRetries = (props['retries']) ? props['retries'] : 3;
			
			if (props['success']) this.bind('success', props['success']);
			if (props['error']) this.bind('error', props['error']);
			if (props['forgotPassword']) this.bind('forgotPassword', props['forgotPassword']);

		}
		
		// Public Methods.
		this.render = function () { 
			var bgLeft, bgTop, bgWidth, bgHeight, bodW, bodH;
			console.log('SimpleLogin.render() called');
			
			// Render the View
			bodW = $('body').width();
			bodH = $('body').height();
			
			if (_block) {
				bgLeft = 0; 
				bgTop = 0;
				bgWidth = bodW;
				bgHeight = bodH;				
			}
			else {
				bgWidth = 266;
				bgHeight = 194;
				bgLeft = (bodW-bgWidth)/2; 
				bgTop = (bodH-bgHeight)/2;
			}
			this.self.css({'z-index': '9999999', 'width': (bgWidth + 'px'), 'height': (bgHeight + 'px'), 'top': (bgTop + 'px'), 
							'left': (bgLeft + 'px'), 'background-color': '#000', 'float': 'left', 'position': 'absolute',
							'opacity': '0.55', 'color': '#FFF', 'text-shadow': '0px 0px 0px 3px; #666', });
			this.self.show();

		}; 
		this.toString = function() {
				return 'SimpleLogin';
		};

	};
	
	return SimpleLogin;

 });